package br.com.android.games.daedal;

import android.content.Context;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;

public class Sounds implements OnCompletionListener {
	private MediaPlayer mp = null;
	public void sound(Context context, int id){
		
		mp = MediaPlayer.create(context, id);
		
		try {			
			mp.setLooping(false);
			mp.setOnCompletionListener(this);
		 
		} catch (Exception e) {
			e.printStackTrace(); 
		}
		
		mp.start();
	}
	
	/*
	 * (non-Javadoc)
	 * @see android.media.MediaPlayer.OnCompletionListener#onCompletion(android.media.MediaPlayer)
	 */
	@Override
	public void onCompletion(MediaPlayer m) {
		m.release();		
	}
}
